﻿package Interface
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	public class SelectableLabel extends Sprite 
	{
		protected var FSelectd:Boolean;
		protected var FText:TextField;
		protected var FSelectdColor:uint;
		protected var FNormalColor:uint;
		
		public function SelectableLabel() 
		{
			FSelectdColor = 0xFFDE00;
			FNormalColor = 0xFFFFFF;
			
			addEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
			addEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);		
		}
		
		protected function OnMouseOver(e:MouseEvent):void
		{			
			FText.textColor = FSelectdColor;
		}
		
		protected function OnMouseOut(e:MouseEvent):void
		{
			if(!FSelectd)
				FText.textColor = FNormalColor;
		}
		
		public function set Selected(ASelected:Boolean):void
		{
			FSelectd = ASelected;
			if(FSelectd)
				FText.textColor = FSelectdColor;
			else
				FText.textColor = FNormalColor;
		}
		
		public function get NormalColor():uint
		{
			return FNormalColor;
		}
		
		public function set NormalColor(AColor:uint):void
		{
			FNormalColor = AColor;
		}
		
		public function get SelectdColor():uint
		{
			return FSelectdColor
		}			
		
		public function set SelectdColor(AColor:uint):void
		{
			FSelectdColor = AColor;
		}
		
		public function get Selected():Boolean
		{
			return FSelectd;
		}
		
		public function set Text(AText:String):void
		{
			FText.text = AText;
		}
		
		public function set TextColor(AColor:uint):void
		{
			FText.textColor = AColor;
		}
	}	
}
